package org.jeecg.modules.mall.util;

import cn.hutool.http.HttpUtil;
import org.jeecg.modules.mall.entity.TbMnAdzone;
import org.jeecg.modules.pdd.util.DingDanXiaUtil;

import java.util.HashMap;
import java.util.Map;

public class TaoBaoUtil {

    public static String getTop100(){


        String url = "http://api.tbk.dingdanxia.com/spk/top";
        Map<String, Object> map = new HashMap<>();
        map.put("apikey", DingDanXiaUtil.dingdanxia_appkey);
        map.put("sale_type",1);
        map.put("back",100);
        map.put("min_id",1);
        map.put("cid",0);
        String resultStr = "";
        try {
            resultStr =    HttpUtil.post(url,map);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return resultStr;
    }

    public static String tiao100zhuanlink(TbMnAdzone tbMnAdzone, String goodId) {

        String url = "http://api.tbk.dingdanxia.com/tbk/id_privilege";
        Map<String, Object> map = new HashMap<>();
        map.put("apikey", DingDanXiaUtil.dingdanxia_appkey);
        map.put("id",goodId);
        map.put("back",100);
        map.put("min_id",1);
        map.put("cid",0);
        String resultStr = "";
        try {
            resultStr =    HttpUtil.post(url,map);
        } catch (Exception e) {
            e.printStackTrace();
        }

        return resultStr;
    }

    /**
     * 淘宝分类
     * @return
     */
    public static String getTabobaoCate(){

        String url = "http://api.tbk.dingdanxia.com/spk/cate";
        Map<String, Object> map = new HashMap<>();
        map.put("apikey", DingDanXiaUtil.dingdanxia_appkey);
        String resultStr = "";
        try {
            resultStr =    HttpUtil.post(url,map);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return resultStr;
    }



}
